package com.llb666.e.shop.api.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.llb666.e.shop.domain.entity.bo.MyCommentBo;
import com.llb666.e.shop.infracore.web.PagedGridResult;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.Date;
import java.util.List;

/**
 * 我的评论.
 *
 * @author llb666
 */
@Data
public class MyCommentVo {

    /**
     * 评论Id.
     */
    private String commentId;

    /**
     * 评论内容.
     */
    private String content;

    /**
     * 发表时间.
     */
    @JsonFormat(shape =JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")
    private Date createdTime;

    /**
     * 商品ID.
     */
    private String itemId;

    /**
     * 商品名称.
     */
    private String itemName;
    /**
     * 商品规格.
     */
    private String specName;

    /**
     * 商品图片.
     */
    private String itemImg;

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        MyCommentVo.Converter INSTANCE = Mappers.getMapper(MyCommentVo.Converter.class);

        MyCommentVo bo2Vo(MyCommentBo activity);

        List<MyCommentVo> bo2VoList(List<MyCommentBo> commentList);

        PagedGridResult<MyCommentVo> bo2VoPage(PagedGridResult<MyCommentBo> page);
    }

}